Repository navigation
feat(spec): a book audience can name a capability, so Setup and Studio docs open only for callers who can open those apps - #37591
objectstack-fleet[bot] wants to merge 6 commits into
Conversation
…o docs open only for callers who can open those apps Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc
…and the REST docs doors Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc
…e Studio book preview; document it Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc
…dger; record the capability arm on the audience liveness row; changeset; Setup docs dogfood pin Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc
📓 Docs Drift CheckThis PR changes 6 package(s): 25 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 12 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 184 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 6ab8b90ca97ba0a89ffc5215e229a538857a9ee7 && git checkout 6ab8b90ca97ba0a89ffc5215e229a538857a9ee7
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 58570d8002dd213f7f65525d881ac935583f4050 99447c4346f0c6dfb7779ca26d2e2c784a858afb && git checkout -B drift-repro 58570d8002dd213f7f65525d881ac935583f4050 && git merge --no-ff 99447c4346f0c6dfb7779ca26d2e2c784a858afb
node scripts/docs-audit/affected-docs.mjs --json 58570d8002dd213f7f65525d881ac935583f4050
|
…on audience test; docs: lint resolves book audience capabilities Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA Contract reviewServed-tier: Inputs read: card #36029 (body and all six comments, ruling 7122770897 included), PR #37591 (body, 25 files, net diff against ① Derived judgments
② Semver level
Two sentences of the changeset body do not hold as written: "Nothing to migrate: no stored or authored value changes meaning" (S1), and "a key beside ③ Boundary flags
④ Design judgment
The arm is what the ruling asked for: one key, a string, strict, described.
S1 (should-fix) — the two manuals claim docs that are not their package's. Nits (no effect on correctness or the contract; left as accepted deviations or a follow-up card):
Implementing files, sentence by sentence.
Implemented-by: VERDICT: PASS |
…ge-less doc A package scope leaves out only a doc stamped with another package, so a stored doc bound to no package is in every scope: include '*' made both manuals claim it and gate it on setup.access / studio.access. Claim by setup_* / studio_* instead, pin an unstamped control doc on spec, REST and MCP, and correct the docs, jsdoc and changeset sentences that said otherwise. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc
Requested by Sales · project thread
Part of #36029 — the code half. The ADR-0046 §6.7 note the ruling also names lands in its own seat-run PR (Tier H); the seat closes the card when both have merged.
Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: none — no
skills/page teaches the book audience forms;content/docs/ui/doc-pages.mdxdocuments the new form in this change维护者速读
What changes
Ruling of record: the maintainer's answer to the decision card, relayed in comment 7122770897 (「A 按系统权限判定」).
@objectstack/spec—BookAudienceSchema/BookAudiencegain a fourth, strict arm{ systemPermission: string }.AudienceCallergainssystemPermissions?: readonly string[];audienceAllowsadmits the arm only for an authenticated caller whose list holds the token, and denies when the list is absent (fail closed, ADR-0049). The other three forms answer exactly as before. Regenerated:content/docs/references/system/book.mdx, the strictness-ledger count (system/409 → 410, the new strict arm). Liveness rowbook.audiencere-verified with the new evidence.@objectstack/rest—resolveDocsAudiencetreats a{ systemPermission }book as gated (no fast path), andresolveAudienceCallerfillssystemPermissionsfrom the caller's own context — the same listholdsRequiredPermissionsreads for an app'srequiredPermissions, so the Setup manual opens for exactly the callers the Setup app opens for. Holdings are read only when such a book exists; a capability-only gate never asks the security service for permission sets. New exportanySystemPermissionAudience; new optional portMetaReadGateAudienceSources.resolveAudienceSystemPermissionsfor a transport whose audience reads someone else's holdings.@objectstack/runtime— the MCP docs door (search_package_docs,read_package_doc) supplies that port on a delegated OAuth envelope, so the delegating person's own capabilities decide, never the token's ceiling (the same rule its{ permissionSet }reading already follows, ADR-0090 D10).@objectstack/setup,@objectstack/studio— each registers a manual (setup_manual,studio_manual;include: '*'over its own package) withaudience: { systemPermission: 'setup.access' }/'studio.access', the token each app'srequiredPermissionsnames.@objectstack/lint—capability-reference-unknownalso resolvesbooks[].audience.systemPermission; itsos explaintext names the new position.ui/(@object-ui/app-shell,@object-ui/i18n) — Studio's book preview shows a capability-gated book as "Capability: TOKEN" / 「系统权限:TOKEN」 instead of "Org", and the book form's JSON schema round-trips the new form.content/docs/ui/doc-pages.mdxdocuments the form and when to use it.Decided in the thread (small, listed here per the standing rule):
systemPermission(the ruling left it to the spec lane): it is the same word as the grant side,systemPermissions, which is what an author writes on the permission set.systemPermissions(what the app gate reads) rather than a freshresolvePermissionSetsForContextpass — the ruling's intent is "every admin who can open Setup can read it", and this is that predicate exactly, with no second resolution to drift from it. The MCP door's delegated envelope reads the person's resolved grants, as before.Item 2 of the card (the other
com.objectstack.*docs): exactly two exist onorigin/main,setup_overviewandstudio_overview; both are now gated. No end-user platform help exists today, so nothing stays readable by everyone.Tests
All run against this branch's head; each pinned behaviour was ablated once (rebuild, change, watch it red, restore).
Targeted suites
packages/specsrc/system/book.test.ts— 50/50 (parse of the arm, strictness,audienceAllows, set ≠ capability both ways, fail closed,resolveDocAudiencesunion with a{ systemPermission }book).packages/lintsrc/validate-capability-references.test.ts— 22/22 (typo atbooks[2].audience.systemPermissionwarns; built-in and granted tokens pass; other forms resolve nothing).packages/restsrc/meta-doc-system-permission-audience.test.ts(new) — 12/12: a member without the capability gets the Setup doc in neitherGET /meta/docnor?include=content(body absent from the whole answer),403 PERMISSION_DENIEDonGET /meta/doc/:name, the book absent fromGET /meta/bookand403on its tree, nothing from the implicit package book either; a holder reads all of it; a non-listsystemPermissionsdenies; anonymous 401; no permission-set resolution for a capability-only gate; fast-path control.packages/runtimesrc/domains/mcp-package-docs.test.ts— 26/26 (5 new: session holder / non-holder, set-named-like-capability stays closed, no list fails closed, OAuth person decides, OAuth envelope capability opens nothing — no union).packages/qa/dogfoodtest/setup-docs-audience.dogfood.test.ts(new) — 3/3 on a real boot with the realcreateSetupAppPlugin(): precondition (member 403 on the Setup app, admin 200), member refused on all three doors, admin reads all three plus the manual's tree.uipackages/app-shell/.../adminPreviews.i18n-10862-s2.test.tsx— 42/42 (new case per language for the capability chip).Ablations
needSystemPermissions: false→ the 3 holder pins red (12 → 9 pass).books: []→ both dogfood door pins red (the member reads the doc again — the pre-fix behaviour reproduced on a real boot).Acceptance notes
/apps/com.objectstack.setup/docs/com.objectstack.setup/setup_overview) to the manual (.../docs/setup/setup_overview). No link in the repo names the old one; the flat/docs/setup_overviewpermalink still finds the page.Setup/Studio, English) where the implicit book borrowed the app's translated label. Platform packages ship nobooks.*.labelbundle today; noted, not filed.{ permissionSet, systemPermission }object (both keys) parses as the{ permissionSet }arm with the other key dropped, because that older arm is not strict; making it strict is a narrowing and out of scope.packages/apps/setup/src/index.tssays the package is not yet wired into dev/serve; it is (packages/cli/src/commands/serve.ts,packages/plugins/plugin-dev/src/dev-plugin.ts). Left as is.Verification
Read first:
packages/rest/src/meta-item-read-gate.ts(resolveAudienceCaller,resolveDocsAudience) — the one place the new holdings are read; thenpackages/spec/src/system/book.zod.ts(audienceAllows); thenpackages/runtime/src/domains/mcp-package-docs.ts(packageDocsReadGate).Two-minute check:
pnpm --filter @objectstack/dogfood exec vitest run test/setup-docs-audience.dogfood.test.ts— expect 3 passed: a plain member is refused the Setup doc on every door, the admin reads it.L2 owed at CONTRACT_REVIEW_TIER (Clause-② widening on
packages/spec/src), by the seat — not self-reviewed here.🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc
Generated by Claude Code